home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.0 / PInterfaces / Unmangler.p < prev    next >
Encoding:
Text File  |  1995-04-18  |  2.6 KB  |  70 lines  |  [TEXT/MPS ]

  1. (*---------------------------------------------------------------------------*
  2.  |                                                                           |
  3.  |                            <<< Unmangler.p >>>                            |
  4.  |                                                                           |
  5.  |                         C++ Function Name Decoding                        |
  6.  |                                                                           |
  7.  |                 Copyright Apple Computer, Inc. 1988-1991                  |
  8.  |                           All rights reserved.                            |
  9.  |                                                                           |
  10.  *---------------------------------------------------------------------------*)
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17. UNIT Unmangler;
  18.  INTERFACE
  19. {$ENDC}
  20.         
  21. {$IFC UNDEFINED UsingUnmangler}
  22. {$SETC UsingUnmangler := 1}
  23. {$I+}
  24. {$SETC UnmanglerIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26.  
  27. {$IFC UNDEFINED UsingTypes}
  28. {$I $$Shell(PInterfaces)Types.p}
  29. {$ENDC}
  30.  
  31. {$SETC UsingIncludes := UnmanglerIncludes}
  32.  
  33.         (*
  34.         FUNCTION unmangle(dst: UNIV Ptr; src: UNIV Ptr; limit: LongInt): LongInt; C;
  35.             {This function unmangles C++ mangled symbols (i.e. a symbol with a type signature).
  36.              The mangled C string is passed in “src” and the unmangled C string is returned in
  37.              “dst”.  Up to “limit” characters (not including terminating null) may be retured
  38.              in “dst”.
  39.          
  40.              The function returns,
  41.          
  42.                  -1 ==> error, probably because symbol was not mangled, but looked like it was
  43.                     0 ==> symbol wasn't mangled; not copied either
  44.                     1 ==> symbol was mangled; unmangled result fit in buffer
  45.                     2 ==> symbol was mangled; unmangled result truncated to fit in buffer}
  46.         *)
  47.         
  48.         FUNCTION Unmangle(dst: UNIV StringPtr; src: UNIV StringPtr; limit: LongInt): LongInt;
  49.             {This function unmangles C++ mangled symbols (i.e. a symbol with a type signature).
  50.              The mangled Pascal string is passed in “src” and the unmangled Pascal string is
  51.              returned in “dst”.  Up to “limit” characters may be retured in “dst”.
  52.             
  53.              The function returns,
  54.              
  55.                  -1 ==> error, probably because symbol was not mangled, but looked like it was
  56.                     0 ==> symbol wasn't mangled; not copied either
  57.                     1 ==> symbol was mangled; unmangled result fit in buffer
  58.                     2 ==> symbol was mangled; unmangled result truncated to fit in buffer
  59.                      
  60.              This function is identical to unmangle() above except that all the strings are
  61.              Pascal instead of C strings.
  62.             }
  63.  
  64. {$ENDC} { UsingUnmangler }
  65.  
  66. {$IFC NOT UsingIncludes}
  67.  END.
  68. {$ENDC}
  69.  
  70.